﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Base;
using nspKnow;

public partial class Know_KnowAnswerAdd : BasePage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.Form["AnswerDetail"].Trim() != "" && Request.Form["AnswerDetail"].Trim() != null)
        {
            KnowAnswer answer = new KnowAnswer();
            string str = "";
            answer.Detail = Request.Form["AnswerDetail"].ToString();

            if (Request.Form["AnswerUser"] != "" && Request.Form["AnswerUser"] != null)
            {
                answer.UserName = Request.Form["AnswerUser"].ToString();
            }
            if (Request.Form["UserID"] != "" && Request.Form["UserID"] != null)
            {
                answer.UserID = int.Parse(Request.Form["UserID"].ToString());
            }
            if (Request.Form["AnswerIP"] != "" && Request.Form["AnswerIP"] != null)
            {
                answer.IP = Request.Form["AnswerIP"].ToString();
            }
            if (Request.Form["ID"] != "" && Request.Form["ID"] != null)
            {
                answer.ProblemsID = int.Parse(Request.Form["ID"].ToString());
                str = "ID=" + Request.Form["ID"].ToString();
            }
            answer.AddDate = DateTime.Now;
            answer.Insert(answer);
            Response.Write("<script>alert('您的答案提交成功！');location='Detail.aspx?" + str + "'</script>");
        }
        else
        {
            ShowMessage("回答内容不能为空！");
            return;
        }

    }
}
